<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>安全设置</title>
    <link rel="stylesheet" th:href="@{/layui/layui.css}"  media="all" />
    <link rel="stylesheet" th:href="@{/css/index.css}"  />

</head>
<body>
<div class="main">
    <div class="m_all20">
        <blockquote class="clear layui-elem-quote">修改密码</blockquote>
        <form  class="layui-form">
            <center><table class="tables w_50 f15 hl45">
                <tbody><tr><th>修改密码</th></tr>
                <tr>
                    <td align="center">原密码：　　<div class="layui-inline"><input type="password" id="oldpass" class="layui-input"/></div></td>
                </tr>
                <tr>
                    <td align="center">新密码：　　<div class="layui-inline"><input type="password" id="newpass" class="layui-input"/></div></td>
                </tr>
                <tr>
                    <td align="center">重复输入：　<div class="layui-inline"><input type="password" id="newpass2" class="layui-input"/></div></td>
                </tr>
                <tr>
                    <td align="center" class="p_all20">
                        <button id="saveBtn" class="layui-btn layui-btn-big layui-bt11n-normal white" type="button" name="into_class" >保存</button>
                        <button type="reset" class="layui-btn layui-btn-big layui-btn-warm white" name="reset" id="backid">清空</button>
                    </td>
                </tr>
                </tbody></table></center>
        </form>
    </div>
</div>
<script type="text/javascript" th:src="@{/js/jquery-3.2.1.js}"></script>
<script th:src="@{/layui/layui.all.js}"></script>

<script>

   /* var pwd;
    var oldPwd;
    var newPwd;
    var newPwd2;
    $.get("tea/sess", function (obj) {
        // var date =obj.date;
        console.log(obj);
        //console.log(obj.date);
        pwd = obj.password;
    });

//    $(function(){
        // 给你的HTML中的保存标签设置id为saveBtn
        $('#saveBtn').click(function(){
             oldPwd = $('#oldpass').val();
             newPwd = $('#newpass').val();
             newPwd2 = $('#newpass2').val();

            $.post("/dor/checkfom",
                {
                    oldPwd: oldPwd,
                    newPwd: newPwd,
                    reNewPwd: newPwd2
                },
            function (data) {
                alert(data);
            })

           /!* if(newPwd != newPwd22){
                $("#msg").html("两次输入密码不一致,请重输！").css("display","block");
            }
*!/
        });
//    });

    if(newPwd != newPwd2){
        layer.alert("两次输入密码不一致,请重输！")

    }else if (pwd != oldPwd){
        layer
    }*/

   var pwd;
   var oldPwd;
   var newPwd;
   var newPwd2;

   /* $.get("tea/sess", function (obj) {
    // var date =obj.date;
    console.log(obj);
    //console.log(obj.date);
    pwd = obj.password;
    });*/

   //    $(function(){
   // 给你的HTML中的保存标签设置id为saveBtn
   $('#saveBtn').click(function(){
       oldPwd = $('#oldpass').val();
       newPwd = $('#newpass').val();
       newPwd2 = $('#newpass2').val();

       /*   $.post("/dor/checkfom",
        {
        oldPwd: oldPwd,
        newPwd: newPwd,
        reNewPwd: newPwd2
        },

        layui.use('layer', function(data){
        var layer = layui.layer;

        layer.msg('data');
        })
        )
        */
       $.post("/dor/checkfomTea", {
           oldPwd: oldPwd,
           newPwd: newPwd,
           reNewPwd: newPwd2
       }, function(data){
           /*   alert(data);*/
           layer.open({
               title: '信息',
               content: data //注意，如果str是object，那么需要字符拼接。
           });

       });


   });




</script>
</body>

</html>